// 人员表单组件配置
import imgs from '@/img_path.json'
import {deepCopy} from '@/utils/tools'
import { powerConf, powerConfReadonly } from '@/components/ivew_conf/power/index'
import * as validateFn from '@/utils/validate/index'


const template = {

    personalTypeCheck: [

        {
            icon: 'icon-interactive_fill',
            img: imgs.member,
            title: '会员',
            size: 'small', 
            key: 'isMember',
            span: 8,
        },
        {
            icon: 'icon-interactive_fill',
            img: imgs.sale,
            title: '展业人员',
            size: 'small', 
            key: 'isSales',
            span: 8,
        },
        {
            icon: 'icon-interactive_fill',
            img: imgs.staff,
            title: '职员',
            size: 'small', 
            key: 'isStaff',
            span: 8,
        },

        
    ],
    

    base:{

        label: '基础信息',
        key:'base',
        mods: [

            {
                label: '人员姓名',
                component: 'input',
                conf: {},
                span: 12,
                key: 'nickname',
                ruleValidate:[
                    {required:true, trigger:'blur' , message:'名称不能为空'}
                ]
            },
            {
                label: '手机号码',
                component: 'input',
                conf: {},
                span: 12,
                key: 'phone',
                ruleValidate:[
                    {required:true, trigger:'blur' , message:'手机号不能为空'},
                    {validator: validateFn.phone}
                    
                ]
            },
            
        ]
        
    },

    personalTypeInfo: [

        {
            label: '会员信息',
            key: 'member',
            showKey: 'isMember',
            mods: [
                {
                    label: '会员级别',
                    component: 'select', 
                    conf: {
                        options:[

                            {
                                value: '黄金',
                                lable: '黄金'
                            },
                            {
                                value: '铂金',
                                label: '铂金'
                            },
                            {
                                value: '钻石',
                                label: '钻石'
                            }
                            
                        ]
                    },
                    span: 12,
                    key:'level',
                   
                },
                {
                    label: 'Email',
                    component: 'input',
                    conf: {},
                    span: 12,
                    key:'email'
                },
                {
                    label: '银行卡号',
                    component: 'input',
                    conf: {},
                    span: 12,
                    key:'bankCardNumber'
                },
                {
                    label: '开户行名',
                    component: 'input',
                    conf: {},
                    span: 12,
                    key:'bank'
                },
                {
                    label: '户主姓名',
                    component: 'input',
                    conf: {},
                    span: 12,
                    key:'bankCardOwner'
                },
            ]
        },
        {
            label: '展业信息',
            key: 'sales',
            showKey: 'isSales',
            mods: [

                {
                    label: '签约公司',
                    component: 'input',
                    conf:{},
                    span: 12,
                    key: 'signedCompany'
                },
                {
                    label: '展业证号',
                    component: 'input',
                    conf: {},
                    span: 12,
                    key: 'salesId'
                },
                {
                    label: '合同编号',
                    component: 'input',
                    conf: {},
                    span: 12,
                    key: 'contractId'
                },
                {
                    label:'银行卡号',
                    component: 'input',
                    conf: {},
                    span: 12,
                    key: 'bankCardNumber'
                },
                {
                    label: '开户人名',
                    component: 'input',
                    conf: {},
                    span: 12,
                    key: 'bankCardOwner'
                },
                {
                    label: '开户行名',
                    component: 'input',
                    conf: {},
                    span: 12,
                    key: 'bank'
                }
                   
            ]
        },
        {
            label: '职员信息',
            key: 'staff',
            showKey: 'isStaff',
            mods: [

                {
                    label: '人员职位',
                    component: 'input',
                    conf:{},
                    span: 12,
                    key: 'position'
                },
                {
                    label: '入职时间',
                    component: 'datePicker',
                    conf: {},
                    span: 12,
                    key: 'joinDate'
                },
                {
                    label: '身份证号',
                    component: 'input',
                    conf: {},
                    span: 12,
                    key: 'idCardNumber'
                },
                {
                    label:'紧急联系人',
                    component: 'input',
                    conf: {},
                    span: 12,
                    key: 'emergencyContactName'
                },
                {
                    label: '联系电话',
                    component: 'input',
                    conf: {},
                    span: 12,
                    key: 'emergencyContactPhone'
                },
                {
                    label: '联系地址',
                    component: 'input',
                    conf: {},
                    span: 12,
                    key: 'address'
                },
                {
                    label: '银行卡号',
                    component: 'input',
                    conf: {},
                    span: 12,
                    key: 'bankCardNumber'
                },
                {
                    label: '开户行名',
                    component: 'input',
                    conf: {},
                    span: 12,
                    key: 'bank'
                },
                
                   
            ]
        }
        

        
    ],
    
}

const readonly = deepCopy(template);


readonly['personalTypeCheck'].forEach(item =>{
    item['disabled'] = true;
})

readonly['personalTypeInfo'].forEach(item =>{

    item['mods'].forEach(mod =>{

        mod['component'] = 'input'
        mod['conf']['readonly'] = true
        
    })
    
})

readonly['base']['mods'].forEach(mod =>{
    
    mod['component'] = 'input'
    mod['conf']['readonly'] = true
    
})


template['power'] = powerConf;
readonly['power'] = powerConfReadonly;

export {

    template as newForm,
    readonly
    
}